home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / CSMP Digests / csmp-v1-036.txt < prev    next >
Encoding:
Text File  |  1992-11-18  |  44.9 KB  |  1,208 lines  |  [TEXT/MPS ]

  1. C.S.M.P. Digest             Sun, 29 Mar 92       Volume 1 : Issue 36
  2.  
  3. Today's Topics:
  4.  
  5.     Self-checking for virii
  6.     New Trap Patch Questions
  7.     smallest unit of RTF
  8.     AppleTalk Program Question
  9.     Are there any c++ compilers for the Mac?
  10.     Simple Program...help?
  11.     Preference Files/Folders: How to do under 6.x?
  12.  
  13.  
  14. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  15.  
  16. These digests are available (by using FTP, account anonymous, your email
  17. address as password) in the pub/mac/csmp-digest directory on ftp.cs.uoregon.
  18. edu.  This is also the home of the comp.sys.mac.programmer Frequently Asked
  19. Questions list.
  20.  
  21. These digests are also available via email.  Just send a note saying that you
  22. want to be on the digest mailing list to mkelly@cs.uoregon.edu, and you will
  23. automatically receive each new digest as it is created.
  24.  
  25. The articles in these digests are taken directly from comp.sys.mac.programmer.
  26. They are not edited; all articles included in this digest are in their original
  27. posted form.  The only articles that are -not- included in these digests are
  28. those which didn't receive any replies (except those that give information
  29. rather than ask a question).  All replies to each article are concatenated
  30. onto the original article in the order in which they were received.  Article
  31. threads are not added to the digests until the last article added to the
  32. thread is at least one month old (this is to ensure that the thread is dead
  33. before adding it to the digests).
  34.  
  35. Send administrative mail to mkelly@cs.uoregon.edu.
  36.  
  37. -------------------------------------------------------
  38.  
  39. From: Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer)
  40. Subject: Self-checking for virii
  41. Date: 22 Feb 92 01:01:10 GMT
  42. Organization: MIND LINK! - British Columbia, Canada
  43.  
  44. >                     New Macintosh Virus Discovered
  45. > Virus: MBDF A
  46. > Damage: minimal, but see below
  47. > Spread: may be significant
  48. > Systems affected:  Apple Macintosh computers.  The virus spreads on
  49. >                    all types of system except MacPlus systems and
  50. >                    (perhaps) SE systems; it may be present on MacPlus
  51. >                    and SE systems and not spread, however.
  52. > ...
  53. > Special thanks to the people at Claris who included self-check code
  54. > into their Macintosh software products.  Their foresight resulted in
  55. > an early detection of the virus, and has thus helped the entire Mac
  56. > community.  We strongly encourage other vendors to consider doing the
  57. > same with their products.
  58. > --
  59. > Gene Spafford
  60. > Software Engineering Research Center & Dept. of Computer Sciences
  61. > Purdue University, W. Lafayette IN 47907-1398
  62. > Internet:  spaf@cs.purdue.edu   phone:  (317) 494-7825
  63.  
  64. How would one go about writing code in an application that would self-check for
  65. a virus?  I guess one could do a CRC check on the resource fork...and the CRC
  66. could be stored in the data fork (so the CRC wouldn't be included in
  67. itself)...would this work?
  68. --
  69. - -----------------------------------------------------------------
  70.  Daryl_Spitzer@mindlink.bc.ca     "Life isn't just, life just is."
  71.          a2251@mindlink.bc.ca              -- Me  (I think.)
  72.        Spitzer@UNCAMULT.BITNET
  73. - -----------------------------------------------------------------
  74.  
  75.  
  76.  
  77. - -------------------------
  78.  
  79. From: peirce@outpost.SF-Bay.org (Michael Peirce)
  80. Subject:  Self-checking for virii
  81. Date: 22 Feb 92 05:31:11 GMT
  82. Organization: Peirce Software
  83.  
  84.  
  85. In article <10227@mindlink.bc.ca> (comp.sys.mac.programmer), Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer) writes:
  86. > How would one go about writing code in an application that would self-check for
  87. > a virus?  I guess one could do a CRC check on the resource fork...and the CRC
  88. > could be stored in the data fork (so the CRC wouldn't be included in
  89. > itself)...would this work?
  90.  
  91. There are a wide variety of techniques.  The key is *not* to copy
  92. someone else's technique.  If people all use the same technique, then
  93. the virus writer will have an easier time programming around it.
  94.  
  95. That being said, there are a number of general directions that seem
  96. to work well.  Checksum your code (any code resources your program
  97. uses CODE, WDEF, MDEF, etc).  Look for new resources that shouldn't
  98. be there.  Check the size of resources that sould stay constant. 
  99.  
  100. You may not want to perform an extensive check all the time, maybe
  101. check parts at random so they don't slow your startup time too much.
  102. Also maybe perform checks when you have some idle time.
  103.  
  104. Beyond detecting possible viruses, this can also provide some protection
  105. against your app running when it is damaged in some other way.
  106.  
  107. --  Michael Peirce         --   peirce@outpost.SF-Bay.org
  108. --  Peirce Software        --   Suite 301, 719 Hibiscus Place
  109. --  Macintosh Programming  --   San Jose, California USA 95117
  110. --           & Consulting  --   voice: (408) 244-6554 fax: (408) 244-6882
  111. --                         --   AppleLink: peirce & America Online: AFC Peirce
  112.  
  113.  
  114.  
  115. - -------------------------
  116.  
  117. From: d88-jwa@hemul.nada.kth.se (Jon W{tte)
  118. Subject:  Self-checking for virii
  119. Date: 22 Feb 92 10:57:16 GMT
  120. Organization: Royal Institute of Technology, Stockholm, Sweden
  121.  
  122. .ca> Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer) writes:
  123.  
  124.    How would one go about writing code in an application that would self-check for
  125.    a virus?  I guess one could do a CRC check on the resource fork...and the CRC
  126.    could be stored in the data fork (so the CRC wouldn't be included in
  127.    itself)...would this work?
  128.  
  129. Not verbatim, but close, You have to skip the first N bytes
  130. of the resource fork, since they are used for something or
  131. other that may change. N is probably equal to 256 or so.
  132.  
  133. Another thing to do is to check that Count1ResTypes and
  134. Count1Resources returns the right values, and that your CODE
  135. resources are of the right size.
  136.  
  137. --
  138. This Signature is distributed under the conditions of the Signature License,
  139. available at a fee from   h+@nada.kth.se  (Jon W{tte)  Reading the Signature
  140. implies that you accept to be bound by the terms in said License. Should you
  141. not agree on any of these terms, you must return the Signature unread to me.
  142.  
  143.  
  144.  
  145. - -------------------------
  146.  
  147. From: greeny@top.cis.syr.edu (Jonathan Greenfield)
  148. Subject:  Self-checking for virii
  149. Organization: CIS Dept., Syracuse University
  150. Date: Sat, 22 Feb 92 13:10:08 EST
  151.  
  152. In article <D88-JWA.92Feb22115716@hemul.nada.kth.se> d88-jwa@hemul.nada.kth.se (Jon W{tte) writes:
  153. >.ca> Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer) writes:
  154. >
  155. >   How would one go about writing code in an application that would self-check for
  156. >   a virus?  I guess one could do a CRC check on the resource fork...and the CRC
  157. >   could be stored in the data fork (so the CRC wouldn't be included in
  158. >   itself)...would this work?
  159. >
  160. >Not verbatim, but close, You have to skip the first N bytes
  161. >of the resource fork, since they are used for something or
  162. >other that may change. N is probably equal to 256 or so.
  163. >
  164. >Another thing to do is to check that Count1ResTypes and
  165. >Count1Resources returns the right values, and that your CODE
  166. >resources are of the right size.
  167.  
  168. The only problem with these various techniques is that a *user* may
  169. *legitmately* change resource in order to customize the software.  In
  170. fact, one might legitimately *add* resources.  (An outdated example,
  171. one might add 'mstr', etc. resources to facilitate pulling "puppet
  172. strings" on older applications.  If these old apps had done such
  173. virus checking, then there would be problems.)
  174.  
  175. The main question is, how do you do a *reliable* self-check, that also
  176. does not prevent the user's ability to *reasonably* customize the
  177. software, perhaps to do things you couldn't even have considered.
  178. (making the reasonable assumption that not every piece of
  179. software gets updated ad infinitum...)
  180.  
  181. It strikes me as a real dilemma.  I look forward to proposed solutions.
  182. --
  183. J. S. Greenfield                                         greeny@top.cis.syr.edu
  184. (I like to put 'greeny' here, 
  185. but my d*mn system wants a 
  186. *real* name!)                        "What's the difference between an orange?"
  187.  
  188.  
  189.  
  190. - -------------------------
  191.  
  192. From: jmunkki@hila.hut.fi (Juri Munkki)
  193. Subject:  Self-checking for virii
  194. Date: 22 Feb 92 21:43:51 GMT
  195. Organization: Helsinki University of Technology, Finland
  196.  
  197. In article <D2150035.sm80v7@outpost.SF-Bay.org> peirce@outpost.SF-Bay.org (Michael Peirce) writes:
  198. >You may not want to perform an extensive check all the time, maybe
  199. >check parts at random so they don't slow your startup time too much.
  200. >Also maybe perform checks when you have some idle time.
  201.  
  202. Checking for resource integrity when you have idle time is a very
  203. bad idea on the PowerBooks. I would hate to have an application
  204. that accesses the hard disk when it doesn't need to.
  205.  
  206. Performing random checks on startup could be ok. Personally, I don't
  207. believe that applications should perform checks at all. I like doing
  208. binary patches to programs and I think that virus checks would get
  209. in the way all too often.
  210.  
  211. I haven't had a virus in my system in a few years. The disinfectant
  212. init provides just the amount of protection that I feel that I need.
  213. Of course, I don't download all that much software.
  214.  
  215. The Macintosh virus scene has been very quiet in the recent years. I
  216. hope it stays that way. I remember when nVir was new and PC users were
  217. telling me how DOS was so simple that there wasn't much room for a
  218. virus to work in... It seems to me that they ended up having a lot
  219. more trouble than the Mac users.
  220.  
  221.    ____________________________________________________________________________
  222.   / Juri Munkki        /  Helsinki University of Technology   /  Wind  / Project /
  223.  / jmunkki@hut.fi  /  Computing Center Macintosh Support  /  Surf  / Arashi  /
  224.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  225.  
  226.  
  227.  
  228. - -------------------------
  229.  
  230. From: CXT105@psuvm.psu.edu (Christopher Tate)
  231. Subject:  Self-checking for virii
  232. Date: 22 Feb 92 21:54:27 GMT
  233. Organization: Penn State University
  234.  
  235. In article <1992Feb22.131009.29328@newstand.syr.edu>, greeny@top.cis.syr.edu
  236. (Jonathan Greenfield) says:
  237. >
  238. >The only problem with these various techniques is that a *user* may
  239. >*legitmately* change resource in order to customize the software.  In
  240. >fact, one might legitimately *add* resources.  (An outdated example,
  241. >one might add 'mstr', etc. resources to facilitate pulling "puppet
  242. >strings" on older applications.  If these old apps had done such
  243. >virus checking, then there would be problems.)
  244. >
  245. >The main question is, how do you do a *reliable* self-check, that also
  246. >does not prevent the user's ability to *reasonably* customize the
  247. >software, perhaps to do things you couldn't even have considered.
  248. >(making the reasonable assumption that not every piece of
  249. >software gets updated ad infinitum...)
  250. >
  251. >It strikes me as a real dilemma.  I look forward to proposed solutions.
  252.  
  253. Proposed Solution #1:
  254. - ------------------
  255.  
  256. Rather than checksumming the entire resource fork, checksum only those
  257. resources which are executable code.  Presumably, these resources should
  258. NOT change, EVER, and you don't have problems with people customizing
  259. the menus or what have you.
  260.  
  261. The disadvantage is that it's slower than just using OpenRF to read the
  262. entire resource fork.
  263.  
  264. Another consideration is the addition of resources which shouldn't be
  265. there, such as MBDF's, WDEF's, etc.  It seems to me that checking for
  266. the existence of such unwanted extra code would be the hard part, since
  267. it's very difficult to predict just what vector a new virus would use
  268. for infection.
  269.  
  270. And, to top it all off, you want to avoid having to parse the resource
  271. map, since it's Subject To Change Without Notice.
  272.  
  273. A tricky problem, indeed....  Not hard to do in principle, but rather
  274. difficult to do in a *friendly* manner.
  275.  
  276. - -----
  277. Christopher Tate                 |  Cryptogram #10:
  278. cxt105@psuvm.psu.edu             |
  279. CXT105@PSUVM.BITNET              |  EF'Z J ZBSWMECG FTBDGTF FTJF ITWC
  280. - -------------------------------|  KBYJMF IJZ KL JGW, TW IJZ XWJX QBM
  281. Send me the answer, I love mail! |  FIB LWJMZ.  (FBK UWTMWM)
  282.  
  283.  
  284.  
  285. - -------------------------
  286.  
  287. From: peter@cujo.curtin.edu.au (Peter N Lewis)
  288. Subject:  Self-checking for virii
  289. Organization: NCRPDA, Curtin University
  290. Date: Sun, 23 Feb 1992 02:28:36 GMT
  291.  
  292. In article <92053.165427CXT105@psuvm.psu.edu>, CXT105@psuvm.psu.edu (Christopher Tate) writes:
  293. > In article <1992Feb22.131009.29328@newstand.syr.edu>, greeny@top.cis.syr.edu
  294. > (Jonathan Greenfield) says:
  295. > >
  296. > >The only problem with these various techniques is that a *user* may
  297. > >*legitmately* change resource in order to customize the software.  In
  298. > >fact, one might legitimately *add* resources.  (An outdated example,
  299. > >one might add 'mstr', etc. resources to facilitate pulling "puppet
  300. > >strings" on older applications.  If these old apps had done such
  301. > >virus checking, then there would be problems.)
  302. > Proposed Solution #1:
  303. > --------------------
  304. Amendment 1 :-)
  305.  
  306. > Rather than checksumming the entire resource fork, checksum only those
  307. > resources which are executable code.  Presumably, these resources should
  308. > NOT change, EVER, and you don't have problems with people customizing
  309. > the menus or what have you.
  310.  
  311. Thats not true.  I was patching the CODE resources in THINK Pascal just 
  312. yesterday.  There are several reasons to patch CODE resources, usually
  313. to remove a function you don't like (such as beeping, or displaying
  314. an annoying alert (no, not pirating, boy you people are paranoid!)).
  315.  
  316. > Another consideration is the addition of resources which shouldn't be
  317. > there, such as MBDF's, WDEF's, etc.  It seems to me that checking for
  318. > the existence of such unwanted extra code would be the hard part, since
  319. > it's very difficult to predict just what vector a new virus would use
  320. > for infection.
  321.  
  322. Seems to me a good start would be to create a resource that holds:
  323. The number of resources of each kind (basically your own psuedo copy of
  324. the resource map), and there ids and sizes.  The when you build your 
  325. application, set this resource up in an obviously defunct manner (say
  326. no resources at all), and so just rebuild it from thge current  resource
  327. file.  Otherwise, verify its accuracy, and if it fails TELL the user
  328. that the file has been modify, and ASK them if they did it.  If so,
  329. rebuild the resource info.
  330.  
  331. If you just refuse to run, then after I patch the binaries I'm going to 
  332. have to go fiund the "virus" checking code and patch that too - what a pain!
  333.  
  334. How's that sound?
  335.    Peter.
  336.  
  337. ______________________________________________________________________
  338. Peter N Lewis, NCRPDA, Curtin University      peter@cujo.curtin.edu.au
  339. GPO Box U1987, Perth WA 6001, AUSTRALIA            FAX: +61 9 367 8141
  340.  
  341.  
  342.  
  343.  
  344.  
  345. - -------------------------
  346.  
  347. From: ozma@kuhub.cc.ukans.edu
  348. Subject:  Self-checking for virii
  349. Date: 22 Feb 92 21:45:54 CST
  350. Organization: University of Kansas Academic Computing Services
  351.  
  352. In article <10227@mindlink.bc.ca>, Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer) writes:
  353. > How would one go about writing code in an application that would self-check for
  354. > a virus?  I guess one could do a CRC check on the resource fork...and the CRC
  355. > could be stored in the data fork (so the CRC wouldn't be included in
  356. > itself)...would this work?
  357. > --
  358. > -------------------------------------------------------------------
  359. >  Daryl_Spitzer@mindlink.bc.ca     "Life isn't just, life just is."
  360. >          a2251@mindlink.bc.ca              -- Me  (I think.)
  361. >        Spitzer@UNCAMULT.BITNET
  362. > -------------------------------------------------------------------
  363.  
  364. I believe it's much simpler than that - I understand it's merely a matter of
  365. counting your resources.  I had thought before this that I could merely check
  366. the size of all my CODE resources, but it looks like checking for *additional*
  367. resources is required (although an additional CODE resource was an obvious one
  368. that didn't occur to me either).  Although, checking the size of the resources
  369. is probably still a good idea.
  370.  
  371. Another reason why I see I shouldn't be saving *any* data into my programs own
  372. resoure fork - it just makes the self-check all the trickier.
  373.  
  374. john calhoun-
  375.  
  376.  
  377.  
  378.  
  379. - -------------------------
  380.  
  381. From: greeny@top.cis.syr.edu (Jonathan Greenfield)
  382. Subject:  Self-checking for virii
  383. Organization: CIS Dept., Syracuse University
  384. Date: Sun, 23 Feb 92 09:42:51 EST
  385.  
  386. In article <1992Feb23.022836.942@cujo.curtin.edu.au> peter@cujo.curtin.edu.au (Peter N Lewis) writes:
  387.  
  388. >> >The only problem with these various techniques is that a *user* may
  389. >> >*legitmately* change resource in order to customize the software.  In
  390. >> >fact, one might legitimately *add* resources.  (An outdated example,
  391. >> >one might add 'mstr', etc. resources to facilitate pulling "puppet
  392. >> >strings" on older applications.  If these old apps had done such
  393. >> >virus checking, then there would be problems.)
  394. >
  395. >Seems to me a good start would be to create a resource that holds:
  396. >The number of resources of each kind (basically your own psuedo copy of
  397. >the resource map), and there ids and sizes.  The when you build your 
  398. >application, set this resource up in an obviously defunct manner (say
  399. >no resources at all), and so just rebuild it from thge current  resource
  400. >file.  Otherwise, verify its accuracy, and if it fails TELL the user
  401. >that the file has been modify, and ASK them if they did it.  If so,
  402. >rebuild the resource info.
  403.  
  404. I like the basic idea here.  Set up *some* kind of integrity check, and if
  405. there is a problem, then alert the user and find out whether the change
  406. was made by the user.  If it was, then readjust the integrity parameters
  407. (used for the check), so that any future changes will also be detected.
  408.  
  409. Sounds to me like the best of both worlds--reasonable virus protection, and
  410. support for user customization.
  411. --
  412. J. S. Greenfield                                         greeny@top.cis.syr.edu
  413. (I like to put 'greeny' here, 
  414. but my d*mn system wants a 
  415. *real* name!)                        "What's the difference between an orange?"
  416.  
  417.  
  418.  
  419. - -------------------------
  420.  
  421. From: michael@otago.ac.nz
  422. Subject:  Self-checking for virii
  423. Date: 24 Feb 92 07:41:07 GMT
  424. Organization: University of Otago, Dunedin, New Zealand
  425.  
  426. In article <1992Feb23.022836.942@cujo.curtin.edu.au>, peter@cujo.curtin.edu.au (Peter N Lewis) writes:
  427. > In article <92053.165427CXT105@psuvm.psu.edu>, CXT105@psuvm.psu.edu (Christopher Tate) writes:
  428. >> 
  429. >> Rather than checksumming the entire resource fork, checksum only those
  430. >> resources which are executable code.  Presumably, these resources should
  431. >> NOT change, EVER, and you don't have problems with people customizing
  432. >> the menus or what have you.
  433. > Thats not true.  I was patching the CODE resources in THINK Pascal just 
  434. > yesterday.  There are several reasons to patch CODE resources, usually
  435. > to remove a function you don't like (such as beeping, or displaying
  436. > an annoying alert (no, not pirating, boy you people are paranoid!)).
  437.  
  438. I'm afraid there are more serious problems than that. Consider the fact that
  439. the new version of SANE in Systm 7.0.1 and later patches the floating-point
  440. calls in your code at runtime as it comes through the segment loader. Guess
  441. what will happen to your checksum computed on the disk version when you compare
  442. it with the resource in memory. And no, you can't make it load a fresh copy
  443. from disk, the Resource Manager already has it and insists that you take it...
  444.  
  445. Another code patcher that is virtually indistiguishable from a virus is
  446. FileGuard, which has a very handy application protection facility which works
  447. by modifying the application with CODE that insists that it remain on the same
  448. hard disk. I myself have written a security system that we have been using for
  449. several years that does this. It works just fine, except for Claris
  450. applications where I have to go in and patch their virus alert to say "Sorry,
  451. please ignore this alert" :-(.
  452.  
  453.  
  454.  
  455. Michael(tm) Hamel, Computing Services Centre, University of Otago, New Zealand
  456.  
  457. SCREMBY (n.)                       
  458. The dehydrated felt-tip pen attached by a string to the `Don't Forget'
  459. board in the kitchen which has never worked in living memory but which no
  460. one can be bothered to throw away.
  461.  
  462.  
  463.  
  464. - -------------------------
  465.  
  466. From: quinn@cs.uwa.oz.au (Quinn "The Eskimo!")
  467. Subject:  Self-checking for virii
  468. Date: 25 Feb 92 01:00:58 GMT
  469. Organization: The University of Western Australia
  470.  
  471. In article <1992Feb24.204107.2217@otago.ac.nz>, michael@otago.ac.nz writes:
  472. > In article <1992Feb23.022836.942@cujo.curtin.edu.au>, peter@cujo.curtin.edu.au (Peter N Lewis) writes:
  473. > > 
  474. > > Thats not true.  I was patching the CODE resources in THINK Pascal just 
  475. > > yesterday.  There are several reasons to patch CODE resources, usually
  476. > > to remove a function you don't like (such as beeping, or displaying
  477. > > an annoying alert (no, not pirating, boy you people are paranoid!)).
  478. > > 
  479. > I'm afraid there are more serious problems than that. Consider the fact that
  480. > the new version of SANE in Systm 7.0.1 and later patches the floating-point
  481. > calls in your code at runtime as it comes through the segment loader. Guess
  482. > what will happen to your checksum computed on the disk version when you compare
  483. > it with the resource in memory. And no, you can't make it load a fresh copy
  484. > from disk, the Resource Manager already has it and insists that you take it...
  485.  
  486. If the new SANE is anything like Omega SANE then it patches the code when
  487. you execute the SANE trap not when the segment is loaded.  Thus your code
  488. would not be modified until you do some SANE calls.  One would assume that
  489. you can organise to do your anti-virus checksum before you make any SANE
  490. calls.
  491.  
  492. Quinn "The Eskimo!"   <quinn@cs.uwa.oz.au>   "Real Coke, Diet .sig"
  493. Department of Computer Science, The University of Western Australia
  494.  
  495.  
  496.  
  497. - -------------------------
  498.  
  499. From: the.cloud@applelink.apple.com (Ken McLeod)
  500. Subject:  Self-checking for virii
  501. Date: 25 Feb 92 06:52:23 GMT
  502. Organization: Apple Computer, Inc.
  503.  
  504. In article <D2150035.sm80v7@outpost.SF-Bay.org>, peirce@outpost.SF-Bay.org (Michael Peirce) writes:
  505. > In article <10227@mindlink.bc.ca> (comp.sys.mac.programmer), Daryl_Spitzer@mindlink.bc.ca (Daryl Spitzer) writes:
  506. > > 
  507. > > How would one go about writing code in an application that would self-check for
  508. > > a virus?  I guess one could do a CRC check on the resource fork...and the CRC
  509. > > could be stored in the data fork (so the CRC wouldn't be included in
  510. > > itself)...would this work?
  511. > ...
  512. > to work well.  Checksum your code (any code resources your program
  513. > uses CODE, WDEF, MDEF, etc).  Look for new resources that shouldn't
  514. > be there.  Check the size of resources that sould stay constant. 
  515.  
  516.  One major problem to be aware of, if you're thinking about checksumming your
  517. CODE resources to determine their integrity: system software may actually
  518. modify your code at runtime! A prime example is OmegaSANE (built into System
  519. 7.0.1), which backpatches _FP68K trap calls into JSR's on the fly. Checking
  520. the size and number of resources is less thorough than a CRC, but probably a
  521. better strategy for compatibility with future system "enhancements".
  522.  
  523. -ken
  524. been there, got bit
  525.  
  526. --
  527. Ken McLeod
  528. Support Technologies Group
  529. Apple Computer, Inc.
  530. AppleLink: THE.CLOUD  Internet: the.cloud@applelink.apple.com
  531.  
  532.  
  533.  
  534. - -------------------------
  535.  
  536. From: trebor@foretune.co.jp (Robert J Woodhead)
  537. Subject:  Self-checking for virii
  538. Date: 28 Feb 92 02:33:19 GMT
  539. Organization: Foretune Co., Ltd.
  540.  
  541. the.cloud@applelink.apple.com (Ken McLeod) writes:
  542. > One major problem to be aware of, if you're thinking about checksumming your
  543. >CODE resources to determine their integrity: system software may actually
  544. >modify your code at runtime! A prime example is OmegaSANE (built into System
  545. >7.0.1), which backpatches _FP68K trap calls into JSR's on the fly. Checking
  546. >the size and number of resources is less thorough than a CRC, but probably a
  547. >better strategy for compatibility with future system "enhancements".
  548.  
  549. OmegaSANE does not modify a _FP68k trap until the trap is actually called.
  550. Therefore, if you do your code integrity checking _before_ the code
  551. being checked has been executed, you should be ok.  If you want to be
  552. paranoid, do your checking in your initial segment, and do a different
  553. check for that segment (less rigorous) and a more rigorous check of
  554. as-yet unexecuted segments.
  555.  
  556. That being said:
  557.  
  558. Apple's decision to allow system software to modify user programs on
  559. the fly is, IMHO, _EXTREMELY ILL ADVISED_.  Especially since it can
  560. cause software to break if the existing software jumps directly to
  561. a _FP68K trap and not to the previous MOVE instruction.  Anyone who
  562. wants real speed in FPU ops either gets the trap address or goes
  563. directly to the FPU.  If Apple wants to specify a faster but more
  564. complicated way of accessing SANE (such as a call that gives us the
  565. ROM addresses), fine.  But keepa your handsa offa my code!
  566.  
  567. -- 
  568. +---------------------------------------------------------------------------+ 
  569. | Robert J. Woodhead, Biar Games / AnimEigo, Incs.    trebor@foretune.co.jp |
  570. | "9/13/99 : First nuclear explosion on the far side of the moon"           |
  571. |     --- One of the many headlines in Gainax's "Otaku no Video 1985"       |
  572.  
  573.  
  574.  
  575. ---------------------------
  576.  
  577. From: bts39313@uxa.cso.uiuc.edu (Benjamin T Sander)
  578. Subject: New Trap Patch Questions
  579. Organization: University of Illinois at Urbana
  580. Date: Sat, 22 Feb 1992 08:30:14 GMT
  581.  
  582. I am trying to patch HGetVInfo, which has trap number $A207.  Problem is,
  583. it has the same dispatch vector as getVolInfo ($A007).  Is there any
  584. way I can tell which trap called me inside of my patch?  
  585.  
  586. Is the last trap called by the system stored anywhere in memory?
  587.  
  588. How do the HFS calls tell the difference?
  589.  
  590. Thanks,
  591.  
  592. Ben Sander
  593.  
  594.  
  595.  
  596.  
  597. - -------------------------
  598.  
  599. From: mkahl@world.std.com (Michael Kahl)
  600. Subject:  New Trap Patch Questions
  601. Date: 23 Feb 92 02:12:53 GMT
  602. Organization: Enginuity Inc.
  603.  
  604. In article <1992Feb22.083014.25749@ux1.cso.uiuc.edu> bts39313@uxa.cso.uiuc.edu (Benjamin T Sander) writes:
  605. >I am trying to patch HGetVInfo, which has trap number $A207.  Problem is,
  606. >it has the same dispatch vector as getVolInfo ($A007).  Is there any
  607. >way I can tell which trap called me inside of my patch?  
  608. >
  609. >Is the last trap called by the system stored anywhere in memory?
  610. >
  611. >How do the HFS calls tell the difference?
  612.  
  613. This can be done for register-based traps only (of which the trap in question
  614. is one).
  615.  
  616. On entry to such traps, the low word of register D1 contains the trap word.  So
  617. to distinguish between _GetVolInfo and _HGetVInfo, you would do:
  618.  
  619.     BTST  #9,D1
  620.  
  621. By the way, this D1 stuff is important to know if you ever *patch* a register
  622. based trap:  it is important to restore D1 before chaining on to the real trap.
  623.  
  624. -- 
  625. Michael Kahl, Software Architect, Enginuity Inc.
  626. mkahl@world.std.com  -or-  75236.3146@compuserve.com
  627. Disclaimer:  Whoa!  Did I say THAT??!
  628.  
  629.  
  630.  
  631. - -------------------------
  632.  
  633. From: keith@Apple.COM (Keith Rollin)
  634. Subject:  New Trap Patch Questions
  635. Date: 25 Feb 92 03:51:43 GMT
  636. Organization: Apple Computer Inc., Cupertino, CA
  637.  
  638. In article <1992Feb22.083014.25749@ux1.cso.uiuc.edu> bts39313@uxa.cso.uiuc.edu (Benjamin T Sander) writes:
  639. >I am trying to patch HGetVInfo, which has trap number $A207.  Problem is,
  640. >it has the same dispatch vector as getVolInfo ($A007).  Is there any
  641. >way I can tell which trap called me inside of my patch?  
  642. >
  643. >Is the last trap called by the system stored anywhere in memory?
  644. >
  645. >How do the HFS calls tell the difference?
  646.  
  647. I believe that for OS traps, the trap number is left in one of the
  648. registers (D1, I think). You can check this yourself with a debugger.
  649. Or, since the stack pointer points to the return address, you can use
  650. that to get a pointer to the A-Trap instruction and retrieve the
  651. trapword yourself.
  652.  
  653. -- 
  654. - ----------------------------------------------------------------------------
  655. Keith Rollin           ---            <Taligent .signature under construction>
  656. Disclaimer: Pretty soon, I really _won't_ be speaking for Apple...
  657.  
  658.  
  659.  
  660. - -------------------------
  661.  
  662. From: nerm@apple.com (Dean Yu)
  663. Subject:  New Trap Patch Questions
  664. Date: 26 Feb 92 18:14:24 GMT
  665. Organization: Apple Computer, Inc.
  666.  
  667. In article <1992Feb22.083014.25749@ux1.cso.uiuc.edu>, bts39313@uxa.cso.uiuc.edu (Benjamin T Sander) writes:
  668. > I am trying to patch HGetVInfo, which has trap number $A207.  Problem is,
  669. > it has the same dispatch vector as getVolInfo ($A007).  Is there any
  670. > way I can tell which trap called me inside of my patch?  
  671. > Is the last trap called by the system stored anywhere in memory?
  672. > How do the HFS calls tell the difference?
  673. > Thanks,
  674. > Ben Sander
  675.  
  676.   For OS traps, the trap word will be in the low word of D1 upon entry
  677. to the routine.  You can look at this to determine whether the
  678. H bit is set.  This is how things are now, but as always, it might
  679. change in the future.
  680.  
  681.   -- Dean Yu
  682.      Blue Meanie, Negative Ethnic Role Model, Window Cleaner,
  683.       Skanky Hack Consultant, etc.
  684.      Apple Computer, Inc.
  685.  
  686.  
  687.  
  688. ---------------------------
  689.  
  690. From: connolly@convex.com (Dan Connolly)
  691. Subject: smallest unit of RTF
  692. Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
  693. Date: Tue, 25 Feb 1992 00:26:30 GMT
  694.  
  695. Broad question: what do you folks (formatted text application developers)
  696. use as a reference for the Rich Text Format?
  697.  
  698. Specific question: what's the minimum content of a piece of Rich Text?
  699. In other words: it's fairly clear what makes a legal Rich Text document,
  700. but what makes a legal rich text "chunk" or "selection" or "run?"
  701.  
  702. Is this a legal "chunk" of rich text:
  703.  
  704. {\rtf1\ansi\deff0{\fonttbl{\f0\fmodern Courier;}}\pard\plain Hello World.\par}
  705.  
  706. how about this:
  707. \pard \plain Hello World.\par
  708.  
  709. or this:
  710. Hello World.
  711.  
  712. or this:
  713. Hello \bWorld.
  714. or this:
  715. Hello \bWorld.}
  716. or:
  717. Hello {\bWorld.}
  718.  
  719. Dan
  720.  
  721.  
  722.  
  723.  
  724. - -------------------------
  725.  
  726. From: Bruce.Hoult@bbs.actrix.gen.nz
  727. Subject:  smallest unit of RTF
  728. Date: 26 Feb 92 02:33:14 GMT
  729. Organization: Actrix Information Exchange
  730.  
  731. In article <1992Feb25.002630.13250@news.eng.convex.com> connolly@convex.com (Dan Connolly) writes:
  732. > Broad question: what do you folks (formatted text application developers)
  733. > use as a reference for the Rich Text Format?
  734.  
  735. I just see what MS Word will generate or accept :-)
  736.  
  737.  
  738. > Specific question: what's the minimum content of a piece of Rich Text?
  739.  
  740. A little experimentation shows that...
  741.  
  742. {\rtf1 Hello \b World.}
  743.  
  744. ... is the least that Word 4 will accept in a text file (and offer to parse
  745. as rtf).  You should be able to experiment with rtf resources in the clipboard
  746. yourself.
  747.  
  748. -- 
  749. Bruce.Hoult@bbs.actrix.gen.nz   Twisted pair: +64 4 477 2116
  750. BIX: brucehoult                 Last Resort:  PO Box 4145 Wellington, NZ
  751. "Cray's producing a 200 MIPS personal computer with 64MB RAM and a 1 GB
  752. hard disk that fits in your pocket!"   "Great!  Is it PC compatable?"
  753.  
  754.  
  755.  
  756. - -------------------------
  757.  
  758. From: suitti@ima.isc.com (Stephen Uitti)
  759. Subject:  smallest unit of RTF
  760. Date: 26 Feb 92 19:43:45 GMT
  761. Organization: Interactive Systems, Cambridge, MA 02138-5302
  762.  
  763. >> Specific question: what's the minimum content of a piece of Rich Text?
  764. >
  765. >A little experimentation shows that...
  766. >
  767. >{\rtf1 Hello \b World.}
  768. >
  769. >... is the least that Word 4 will accept in a text file (and offer to parse
  770. >as rtf).  You should be able to experiment with rtf resources in the clipboard
  771. >yourself.
  772.  
  773. Yes.  My copy of Word 4 uses Times 12 for the font.  My own RTF
  774. reader uses Chicago 12, after complaining that it couldn't find
  775. font one in the font table (there is no font table).  Why
  776. Chicago?  Well, without a font table, I assume that the Mac has a
  777. system font, font 0.  Perhaps it isn't Chicago for non-US
  778. systems...  but it should still be a font.  Why 12?  I can't
  779. remember.  Maybe it is in the RTF spec.
  780.  
  781. Stephen.
  782.  
  783.  
  784.  
  785. - -------------------------
  786.  
  787. From: MacUserLabs@cup.portal.com (Stephan - Somogyi)
  788. Subject:  smallest unit of RTF
  789. Date: 28 Feb 92 00:21:04 GMT
  790. Organization: The Portal System (TM)
  791.  
  792. Bruce.Hoult@bbs.actrix.gen.nz writes:
  793.  
  794. >I just see what MS Word will generate or accept :-)
  795.  
  796. This, unfortunately, will not work any more. Microsoft changed the RTF
  797. format in Word 5 for "better PC compatibility." A Word 5-generated RTF
  798. file is not usable completely by Word 4 since, for example, smart
  799. single and double quotes don't travel.
  800.  
  801. W4 ignores RTF tokens it doesn't know about and W5 has defined
  802. specific new tokens for many characters instead of using the explicit
  803. numeric ASCII value.
  804.  
  805. PageMaker's RTF import filter also doesn't like W5's RTF, however I'm
  806. certain that they're working on that.
  807.  
  808. _____________________________________________________________________
  809. Stephan Somogyi                                               MacUser
  810.  
  811.  
  812.  
  813. ---------------------------
  814.  
  815. From: Kevin@nivek.ca1.leids.com
  816. Subject: AppleTalk Program Question
  817. Date: 23 Feb 92 06:31:06 GMT
  818.  
  819. Can someone briefly explain to me why it is that some programs can
  820. accessed at the same time on an AppleTalk network and other programs
  821. will not allow you to do so (you get a message saying that the file
  822. or program is in use).  Is it difficult to design a program that can
  823. be accessed my multiple users?
  824.  
  825. If you could send replies to my address I'd appreciate it as I do
  826. not get regular feeds from this newsgroup. Thanks a bunch!
  827. (Kevin@nivek.ca1.leids.com)
  828.  
  829. _____
  830. |...........\
  831. |.............\
  832. |...............\____________________
  833. |........Kevin Kurtz...........................|.........\
  834. |........Mariana Elementary.............|_____\__
  835. |........Apple Valley, CA.......................................)
  836. |........Kevin@nivek.ca1.leids.com.....................)
  837. |_______________________________/
  838.         ///////////////
  839.         ////////////
  840.         /////////
  841.         ///////
  842.         ////
  843.  
  844.  
  845.  
  846. - -------------------------
  847.  
  848. From: d88-jwa@hemul.nada.kth.se (Jon W{tte)
  849. Subject:  AppleTalk Program Question
  850. Date: 25 Feb 92 10:35:00 GMT
  851. Organization: Royal Institute of Technology, Stockholm, Sweden
  852.  
  853. > Kevin@nivek.ca1.leids.com writes:
  854.  
  855.    Can someone briefly explain to me why it is that some programs can
  856.    accessed at the same time on an AppleTalk network and other programs
  857.    will not allow you to do so (you get a message saying that the file
  858.    or program is in use).  Is it difficult to design a program that can
  859.    be accessed my multiple users?
  860.  
  861. No, it's just sloppy programmers that modify their application's
  862. resource for (or data fork) that won't share well. Try turning the
  863. "shared" bit on in ResEdit; many programs actually CAN share, but
  864. hasn't got this bit set so the finder won't let it.
  865.  
  866. --
  867. This Signature is distributed under the conditions of the Signature License,
  868. available at a fee from   h+@nada.kth.se  (Jon W{tte)  Reading the Signature
  869. implies that you accept to be bound by the terms in said License. Should you
  870. not agree on any of these terms, you must return the Signature unread to me.
  871.  
  872.  
  873.  
  874. ---------------------------
  875.  
  876. From: denisb@leland.stanford.edu (Denis Bohm)
  877. Subject: Are there any c++ compilers for the Mac?
  878. Date: 25 Feb 92 20:48:38 GMT
  879. Organization: DSG, Stanford University
  880.  
  881. Are there any c++ compilers for the Mac?  I am looking for one that
  882. runs on the mac OS, not unix...
  883. -- 
  884. Denis Bohm (denis@redwood.com -or- denisb@leland.stanford.edu)
  885.  
  886.  
  887.  
  888. - -------------------------
  889.  
  890. From: barczejj@ss2.wpafb.af.mil (Jeff J Barczewski 52824)
  891. Subject:  Are there any c++ compilers for the Mac?
  892. Date: 28 Feb 92 19:02:38 GMT
  893. Organization: Air Force Institute of Technology
  894.  
  895. denisb@leland.stanford.edu (Denis Bohm) writes:
  896.  
  897. >Are there any c++ compilers for the Mac?  I am looking for one that
  898. >runs on the mac OS, not unix...
  899. >-- 
  900. >Denis Bohm (denis@redwood.com -or- denisb@leland.stanford.edu)
  901.  
  902. Symantec offers Zortech C++ and Apple has its own MPW C++. Note the
  903. Zortech one is a globally optimizing compiler versus Apple's cfront
  904. translator.
  905.                           Jeff SkI
  906.  
  907.  
  908.  
  909. ---------------------------
  910.  
  911. From: danny@utkux1.utk.edu (Danny McCampbell)
  912. Subject: Simple Program...help?
  913. Date: 25 Feb 92 21:12:19 GMT
  914. Organization: University of Tennessee
  915.  
  916. I have been asked to write a simple program that does nothing more that display
  917. a dialog at startup and will not continue until the user clicks OK.  I do not
  918. want this program to run as a startup application under system seven.  I would
  919. like it to be an extension.  I have never written anything but stand along
  920. applications.  Could someone please send me some sample code(in THINK Pascal)
  921. that was used as an extension.  I just need to know how to get started, etc. 
  922. Thanks.
  923.  
  924. Danny
  925.  
  926. Also, how hard is it to modify the driver of a hard disk not to show the HD
  927. icon on the desktop when a user boots from a floppy?  Or is there an easier way
  928. to achieve this? 
  929.  
  930.  
  931.  
  932. - -------------------------
  933.  
  934. From: stevec@Apple.COM (Steve Christensen)
  935. Subject:  Simple Program...help?
  936. Date: 27 Feb 92 03:28:14 GMT
  937. Organization: Apple Computer Inc., Cupertino, CA
  938.  
  939. danny@utkux1.utk.edu (Danny McCampbell) writes:
  940. >Also, how hard is it to modify the driver of a hard disk not to show the HD
  941. >icon on the desktop when a user boots from a floppy?  Or is there an easier way
  942. >to achieve this? 
  943.  
  944. Really hard since the hard disk driver isn't responsible for drawing its icon
  945. on the desktop.  From that angle, the best you could do would be to make the
  946. icon "clear", but the Finder will still draw the HD's name.
  947.  
  948. The other way, of course, is to muck with the Finder, but _I_ wouldn't do
  949. that...
  950.  
  951. steve
  952.  
  953. -- 
  954. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  955.   Steve Christensen            Never hit a man with glasses.
  956.   stevec@apple.com            Hit him with a baseball bat.
  957.  
  958.  
  959.  
  960. - -------------------------
  961.  
  962. From: redmand@tramp.Colorado.EDU (REDMAND CHRISTOPHER M)
  963. Subject:  Simple Program...help?
  964. Date: 28 Feb 92 03:07:32 GMT
  965. Organization: University of Colorado, Boulder
  966.  
  967. stevec@Apple.COM (Steve Christensen) writes:
  968.  
  969. >danny@utkux1.utk.edu (Danny McCampbell) writes:
  970. >>Also, how hard is it to modify the driver of a hard disk not to show the HD
  971. >>icon on the desktop when a user boots from a floppy?  Or is there an easier way
  972. >>to achieve this? 
  973.  
  974. >Really hard since the hard disk driver isn't responsible for drawing its icon
  975. >on the desktop.  From that angle, the best you could do would be to make the
  976. >icon "clear", but the Finder will still draw the HD's name.
  977.  
  978. Not necessarily ... it depends on whether or not you want it to be totally
  979. inaccessible or just hidden from the finder.  If you want total transparency,
  980. there are at least hard disk utilities that can provide this by acting as
  981. though the hard disk were unformatted.  La Cie has a package that does this,
  982. I don't know about anyone else.
  983.  
  984. Now if you want to have access to the disk, but just keep it hidden, that's
  985. really hard.
  986.  
  987.     - Chris
  988.  
  989.  
  990.  
  991. ---------------------------
  992.  
  993. From: gft_robert@gsbacd.uchicago.edu (opcode ranger)
  994. Subject: Preference Files/Folders: How to do under 6.x?
  995. Date: 26 Feb 92 01:07:58 GMT
  996.  
  997. Does anyone out there have any sample code for creating a preferences file in
  998. the preferences folder  under System 6.x -- or can they point me to some?  (The
  999. code will go in a commercial project, so it needs to be free o' strings).
  1000.  
  1001. I believe that in order to find the pref folder under 6.x I would go to the
  1002. blessed folder and do something like PBGetCatInfo() with the directory name of
  1003. "Preferences", right?
  1004.  
  1005. OK, but if I need to create pref file in this folder, what's the best way to do
  1006. it? (I know I also need to check to see if it's in the blessed folder itself
  1007. first).  This sounds like another one of those situations where I'm going to
  1008. have to create a working directory, something I Really Don't Want To Do.
  1009.  
  1010. Is there any sample code from Apple on this?  I checked the snippets, but saw
  1011. none.
  1012.  
  1013. On a related note, what's the Correct Thing to do with regard to keeping
  1014. pref files open: keep them open as long as your app is open, writing to them
  1015. when necessary, or only opening, writing, and closing them every time you need
  1016. to write to them?
  1017.  
  1018. Any info much appreciated! 
  1019.  
  1020. Robert
  1021.  
  1022.  
  1023. -- 
  1024. ==============================================================================
  1025. = gft_robert@gsbacd.uchicago.edu * "Out there on a darkened road, the lights =
  1026. = are dead and the cars explode" -- "Good Things", Sisters of Mercy           =
  1027. ==============================================================================
  1028.  
  1029.  
  1030.  
  1031. - -------------------------
  1032.  
  1033. From: peter@cujo.curtin.edu.au (Peter N Lewis)
  1034. Subject:  Preference Files/Folders: How to do under 6.x?
  1035. Organization: NCRPDA, Curtin University
  1036. Date: Wed, 26 Feb 1992 07:01:42 GMT
  1037.  
  1038. In article <1992Feb25.190758.1@gsbacd.uchicago.edu>, gft_robert@gsbacd.uchicago.edu (opcode ranger) writes:
  1039.  
  1040. > Does anyone out there have any sample code for creating a preferences file in
  1041. > the preferences folder  under System 6.x -- or can they point me to some?  (The
  1042. > code will go in a commercial project, so it needs to be free o' strings).
  1043.  
  1044.  procedure GetPrefsFSSpec (var fs: FSSpec);
  1045.   var
  1046.    gv: longInt;
  1047.    oe: OSErr;
  1048.    pb: HParamBlockRec;
  1049.    sysenv: SysEnvRec;
  1050.    s: str255;
  1051.    dummy: longInt;
  1052.  begin
  1053.   if (Gestalt(gestaltFindFolderAttr, gv) <> noErr) | 
  1054.      (not BTST(gv, gestaltFindFolderPresent)) | 
  1055.      (FindFolder(kOnSystemDisk, kPreferencesFolderType, kCreateFolder, fs.vRefNum, fs.parID) <> NoErr) then begin
  1056.    oe := SysEnvirons(1, sysenv);
  1057.    with pb do begin
  1058.     fs.vRefNum := sysenv.sysVRefNum;
  1059.     GetIndString(s, prefsStrhResID, prefsFolderNameStrhIndex);
  1060.     if DirCreate(sysenv.sysVRefNum, 0, s, fs.parID) <> noErr then begin
  1061.      ioNamePtr := @s;
  1062.      ioVRefNum := fs.vRefNum;
  1063.      ioFDirIndex := 0;
  1064.      ioDirID := 0;
  1065.      if (PBGetCatInfo(@pb, false) = noErr) & (BAND(ioFlAttrib, $0010) <> 0) then
  1066.       fs.parID := pb.ioDirID
  1067.      else
  1068.       fs.parID := 0;
  1069.     end;
  1070.    end;
  1071.   end;
  1072.   GetIndString(s, prefsStrhResID, prefsNameStrhIndex);
  1073.   fs.name := s;
  1074.  end;
  1075.  
  1076. Where STR# id prefsStrResID has two strings, normally
  1077. Preferences             <the folder name for System 6>
  1078. MyApp Preferences       <the prefs file name>
  1079.  
  1080. For System 6, there is no way to tell the nationalized name for the prefs 
  1081. file, so you just have to either internationalize your app, or leave it
  1082. to the user to change.  Alternatively you could not do the DirCreate,
  1083. and simple leave the FSSpec with the sysVRefNum out of then sysenvirons
  1084. call, and a dirID of 0.  I prefer the former (obviously, thats what 
  1085. my code does :-), which makes System 6 behave as closely to System 7
  1086. as possible.
  1087.  
  1088. HTH,
  1089.    Peter.
  1090.  
  1091. ______________________________________________________________________
  1092. Peter N Lewis, NCRPDA, Curtin University      peter@cujo.curtin.edu.au
  1093. GPO Box U1987, Perth WA 6001, AUSTRALIA            FAX: +61 9 367 8141
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099. - -------------------------
  1100.  
  1101. From: stanger@otago.ac.nz (Nigel Stanger)
  1102. Subject:  Preference Files/Folders: How to do under 6.x?
  1103. Date: 26 Feb 92 20:23:42 GMT
  1104. Organization: University of Otago, Dunedin, New Zealand
  1105.  
  1106. In article <1992Feb25.190758.1@gsbacd.uchicago.edu>, 
  1107. gft_robert@gsbacd.uchicago.edu (opcode ranger) writes:
  1108. [...]
  1109. > On a related note, what's the Correct Thing to do with regard to keeping
  1110. > pref files open: keep them open as long as your app is open, writing to them
  1111. > when necessary, or only opening, writing, and closing them every time you 
  1112. > need to write to them?
  1113.  
  1114. I don't know about the Correct Thing, but I use the second
  1115. approach. I display the Prefs dialog, the user makes all their
  1116. changes, and when they hit OK, I open the Prefs file, save out
  1117. the changes, then close it again. It probably depends on how
  1118. often you expect people to change the prefs - in my case probably
  1119. not very often, but your mileage may vary.
  1120.  
  1121. -- 
  1122. See ya
  1123.                                 Nigel.
  1124. - --------------------------------------------------------------------
  1125. Nigel Stanger,                  Internet: stanger@otago.ac.nz
  1126. University of Otago,            Phone: +64 3 479-8179
  1127. Dunedin, NEW ZEALAND.           Fax:   +64 3 479-8311
  1128. "Oh, a SCYTHE!!" -- Edmund Blackadder, "Blackadder II"
  1129.  
  1130.  
  1131.  
  1132. - -------------------------
  1133.  
  1134. From: gft_robert@gsbacd.uchicago.edu (opcode ranger)
  1135. Subject:  Preference Files/Folders: How to do under 6.x?
  1136. Date: 26 Feb 92 21:32:50 GMT
  1137.  
  1138. In article <1992Feb25.190758.1@gsbacd.uchicago.edu>, I wrote:
  1139. [...]
  1140. >  This sounds like another one of those situations where I'm going to
  1141. > have to create a working directory, something I Really Don't Want To Do.
  1142.  
  1143.  
  1144. Wrong!  As someone quite correctly pointed out to me, there are numerous HFS
  1145. calls under 6.x that I can take advantage of, something I had forgotten (it's
  1146. amazing what you forget when you take a couple of months off from hacking :->).
  1147.  
  1148. Robert
  1149.  
  1150.  
  1151. -- 
  1152. ==============================================================================
  1153. = gft_robert@gsbacd.uchicago.edu * "Out there on a darkened road, the lights =
  1154. = are dead and the cars explode" -- "Good Things", Sisters of Mercy           =
  1155. ==============================================================================
  1156.  
  1157.  
  1158.  
  1159. - -------------------------
  1160.  
  1161. From: dorner@pequod.cso.uiuc.edu (Steve Dorner)
  1162. Subject:  Preference Files/Folders: How to do under 6.x?
  1163. Organization: University of Illinois at Urbana-Champaign
  1164. Date: Thu, 27 Feb 1992 20:33:04 GMT
  1165.  
  1166. stanger@otago.ac.nz (Nigel Stanger) writes:
  1167. >approach. I display the Prefs dialog, the user makes all their
  1168. >changes, and when they hit OK, I open the Prefs file, save out
  1169. >the changes, then close it again.
  1170.  
  1171. Eudora keeps her settings file open all the time.  Settings are kept
  1172. in a resource, and having the settings file open means it's always at
  1173. the top of the resource chain.  This has the benefit of allowing users
  1174. to override resources in Eudora by putting resources in the settings
  1175. file.
  1176.  
  1177. What's nice about putting these resources in the settings file is that
  1178. a) they don't affect other users, like they would if users editted the
  1179. app directly and b) users don't lose their customizations when they upgrade
  1180. to the next version of Eudora.
  1181.  
  1182. I'm really happy with the way it has worked out.
  1183. -- 
  1184. Steve Dorner, U of Illinois Computing Services Office
  1185. Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner
  1186.  
  1187.  
  1188.  
  1189. ---------------------------
  1190.  
  1191. End of C.S.M.P. Digest
  1192. **********************
  1193.